**********************************************************************
Old info:
**********************************************************************
Files in this zip file is a set "skeleton" files for making
generic xll add-in files for use with Excel 32 Bit Office 2007 and later.
I've been making xll files in PowerBasic since mid 90-ties. Since I'm not sure there 
will be a 64bit version of PowerBasic in  the near future
I have decided to migrate some of my code to Freebasic 32bit. As said, the included 
files will enable you to create your own add-ins.

The main files are partial translations from c++ files included in the Excel Software Development Kit found here
https://msdn.microsoft.com/en-us/library/office/bb687883.aspx
it is advicable to read the help file there before jumping into coding.


Making 64bit xll files should be quite easy since the 32 bit "infrastructure" works.

Some of the c-compiled libfiles must of course be recompiled with GCC 64 bit 



All code is Copyleft!
Enjoy!
E Dingsor
**********************************************************************
Updated info: 
**********************************************************************
Skeleton files have been added and updated and now can be compiled into 32bit or 64 bit code without alterations.
You only have to remember that you can only have one version of Excel installed in your computer i.e either 32 or 64 bit.
When compiling 32 og 64 bit xll's you need to have either 32 bit version of xlcall32.dll or 64 bit version of xlcall32.dll in same catalog as source files. Those are provided in zip file

There is a tiny tweak to compiler settings also. See below.



Description of files:

FB_GENERIC32/64_XLL.bas , main file to be compiled. Rename FB_GENERIC_XLL.dll to FB_GENERIC_XLL.xll or whatevername.xll you go for.

xlcall.bi 'Translation of xlcall.h file. Have used DWORD_PTR (instead of DWORD as in preious version) as in original xlcall.h file. By using DWORD_PTR size of variable becomes correct when compiled in both 32 and 64 bit version

new_framewrkc.bi 'partial translation of framewrk.c file. Using new memory class. It contains neccesary exported functions that Excel calls into to recognise the add-in. Study it!


XL_Pascalstr.bi  'routines for reading and writing zstrings or wstrings

FB_Operarr.bas , utility functions for working with arrays and ranges. Ported from PowerBasic, but not all are tested.

FB_XLRegfunc.bas 'Function declarations for registering Excel functions.
Memorymanager.bi ' Conversion of the corresponding cpp/h files in Excel SDK ' Class for handling memory
MemoryPool.bi  ' Conversion of the corresponding cpp/h files in Excel SDK
Myfirstfunctions.bas 'example spreadsheet functions
XLCALL32_CPP.INC 'Conversion of xlcall.cpp file. Callback entrypoint definition and definition of Excel12 and Excel12v functions
GENERIC32/64.xll ' compiled add-in

Book32/64.xlsx 'example file with functions



***************************************
Compilation settings, NB!!!
***************************************
32 Bit
-s gui -dll -export -Wl --subsystem,windows,--kill-at,-e_XLLMAIN

Since FB add's its own dllmain entry function you have to override the dll entrypoint with the -e_ switch since we want our dll to perform actions at startup. I have aliased my DLLMAIN to XLLMAIN i.e the -e_XLLMAIN setting

64 Bit.

 There is a small difference in compilation settings when compiling 32 or 64 bit when overriding dll entrypoint.
32 bit uses -e_ while 64 uses -e 
64 bit then becomes:

-s gui -dll -export -Wl --subsystem,windows,--kill-at,-eXLLMAIN